package com.xinke.module.system.mapper.sms;

import java.util.*;

import com.xinke.component.common.pojo.PageResult;
import com.xinke.component.mybatis.mybatis.core.query.LambdaQueryWrapperExt;
import com.xinke.component.mybatis.mybatis.core.mapper.BaseMapperExt;
import com.xinke.module.system.model.entity.sms.SmsLogDO;
import org.apache.ibatis.annotations.Mapper;
import com.xinke.module.system.model.vo.sms.*;

/**
 * 短信日志 Mapper
 *
 * @author yzx
 */
@Mapper
public interface SmsLogMapper extends BaseMapperExt<SmsLogDO> {

    default PageResult<SmsLogDO> selectPage(SmsLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperExt<SmsLogDO>()
                .eqIfPresent(SmsLogDO::getChannelId, reqVO.getChannelId())
                .eqIfPresent(SmsLogDO::getChannelCode, reqVO.getChannelCode())
                .eqIfPresent(SmsLogDO::getTemplateId, reqVO.getTemplateId())
                .eqIfPresent(SmsLogDO::getTemplateCode, reqVO.getTemplateCode())
                .eqIfPresent(SmsLogDO::getTemplateType, reqVO.getTemplateType())
                .eqIfPresent(SmsLogDO::getTemplateContent, reqVO.getTemplateContent())
                .eqIfPresent(SmsLogDO::getTemplateParams, reqVO.getTemplateParams())
                .eqIfPresent(SmsLogDO::getApiTemplateId, reqVO.getApiTemplateId())
                .eqIfPresent(SmsLogDO::getSmsMobile, reqVO.getSmsMobile())
                .eqIfPresent(SmsLogDO::getUserId, reqVO.getUserId())
                .eqIfPresent(SmsLogDO::getUserType, reqVO.getUserType())
                .eqIfPresent(SmsLogDO::getSendStatus, reqVO.getSendStatus())
                .betweenIfPresent(SmsLogDO::getSendTime, reqVO.getSendTime())
                .eqIfPresent(SmsLogDO::getApiSendCode, reqVO.getApiSendCode())
                .eqIfPresent(SmsLogDO::getApiSendMsg, reqVO.getApiSendMsg())
                .eqIfPresent(SmsLogDO::getApiRequestId, reqVO.getApiRequestId())
                .eqIfPresent(SmsLogDO::getApiSerialNo, reqVO.getApiSerialNo())
                .eqIfPresent(SmsLogDO::getReceiveStatus, reqVO.getReceiveStatus())
                .betweenIfPresent(SmsLogDO::getReceiveTime, reqVO.getReceiveTime())
                .eqIfPresent(SmsLogDO::getApiReceiveCode, reqVO.getApiReceiveCode())
                .eqIfPresent(SmsLogDO::getApiReceiveMsg, reqVO.getApiReceiveMsg())
                .orderByDesc(SmsLogDO::getLogId));
    }

}